//
//  OSL_BottomPopup_DemoVC.swift
//  APSwift
//
//  Created by jianbo.pei on 2023/9/20.
//

import UIKit

class OSL_BottomPopup_DemoVC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        _ = UIButton(type: .custom).then({ make in
            view.addSubview(make)
            make.setTitle("show nav vc", for: .normal)
            make.backgroundColor = .gray
            make.snp.makeConstraints { make in
                make.left.equalTo(50)
                make.top.equalTo(100)
                make.size.equalTo(CGSize(width: 200, height: 40))
            }
            make.addTarget(self, action: #selector(navAction), for: .touchUpInside)
        })
        
        _ = UIButton(type: .custom).then({ make in
            view.addSubview(make)
            make.setTitle("show vc", for: .normal)
            make.backgroundColor = .red
            make.snp.makeConstraints { make in
                make.left.equalTo(50)
                make.top.equalTo(180)
                make.size.equalTo(CGSize(width: 200, height: 40))
            }
            make.addTarget(self, action: #selector(vcAction), for: .touchUpInside)
        })
    }
    
    @objc private func navAction() {
        let exampleVc = OSL_BottomPopup_Nav_Demo1VC()
//        UINavigationController(rootViewController: <#T##UIViewController#>)
//        OSL_BottomPopup_ExampleNavVC(rootViewController: <#T##UIViewController#>)
        let vc = OSL_BottomPopup_ExampleNavVC(rootViewController: exampleVc)
        vc.height = 300
        vc.topCornerRadius = 35
        vc.presentDuration = 0.5
        vc.dismissDuration = 0.5
        vc.shouldDismissInteractivelty = true
//        vc.popupDelegate = self
        present(vc, animated: true, completion: nil)
    }


    @objc private func vcAction() {
        let vc = OSL_BottomPopup_ExampleVC()
        vc.height = 300
        vc.topCornerRadius = 35
        vc.presentDuration = 0.5
        vc.dismissDuration = 0.5
        vc.shouldDismissInteractivelty = false
//        vc.popupDelegate = self
        present(vc, animated: true, completion: nil)
    }
}
